text: Fix incomplete invalidation
authorMatthias Clasen <mclasen@redhat.com>
Tue, 23 Jul 2019 01:01:22 +0000 (18:01 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 23 Jul 2019 14:41:52 +0000 (10:41 -0400)
When a style change affects the text, we need to
clear the cached content, in order to pick up the
new text style.

gtk/gtktext.c

index af9cf73e1d50e79e16198d22cc92ca019feec526..33f5082d04ce4a7d938232b16f75969872761254 100644 (file)
@@ -3262,10 +3262,21 @@ static void
 gtk_text_style_updated (GtkWidget *widget)
 {
   GtkText *self = GTK_TEXT (widget);
+  GtkStyleContext *context;
+  GtkCssStyleChange *change = NULL;
+
+  context = gtk_widget_get_style_context (widget);
+  change = gtk_style_context_get_change (context);
 
   GTK_WIDGET_CLASS (gtk_text_parent_class)->style_updated (widget);
 
   gtk_text_update_cached_style_values (self);
+
+  if (change == NULL ||
+      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
+                                            GTK_CSS_AFFECTS_BACKGROUND |
+                                            GTK_CSS_AFFECTS_CONTENT))
+    gtk_text_queue_draw (GTK_WIDGET (self));
 }
 
 static void